                 /* LPC13xx definitions               */
#include "includes.h"
#include "i2c.h"
#include "gpio.h"
#include "ssp.h"
#include "oled.h"
#include "input.h" 

#include "processadados.h"

#include "plot.h"
#include "interrupcoes.h"

uint32_t nPontos = 0;
uint8_t escala = 1; // 1- 2- 3-
bool reinicializa = false;
bool executando = false;

Coordenada PontoCentral;

extern osThreadId tid_ProcessaDados;                  /* Thread id of thread: ProcessaDados      */
extern osThreadId tid_Plot;                           /* Thread id of thread: Plot      */

osPoolDef(mpool, 64, Ponto);                    // Define memory pool
osPoolId  mpool;

osMessageQDef(MsgBox, 64, Ponto);               // Define message queue
osMessageQId  MsgBox;

osThreadDef(ProcessaDados, osPriorityNormal, 1, 0);
osThreadDef(Plot, osPriorityNormal, 1, 0);

int main()
{ 
    SystemInit();
    SystemCoreClockUpdate();
    SSPInit();
    GPIOInit();
    BotaoInit();
    EncoderInit();
    
    mpool = osPoolCreate(osPool(mpool));                 // create memory pool
    MsgBox = osMessageCreate(osMessageQ(MsgBox), NULL); 
    
    tid_ProcessaDados = osThreadCreate(osThread(ProcessaDados), NULL);
    tid_Plot = osThreadCreate(osThread(Plot), NULL);
    
    osDelay(osWaitForever);
    while(1);
}
